home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4217 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: news.spies.com!usenet
  2. From: Erik Max Francis <max@alcyone.com>
  3. Newsgroups: comp.object,comp.lang.c++,comp.ai.alife,sci.comp-aided
  4. Subject: Re: [Q] Growing Objects
  5. Date: Sun, 28 Jan 1996 18:20:18 -0800
  6. Organization: &tSftDotIotE
  7. Message-ID: <310C2EE2.8171C34@alcyone.com>
  8. References: <30FE8297.41C6@bme.jhu.edu> <RMARTIN.96Jan20093428@rcm.oma.com> <4ef3bo$mjo@news.jhu.edu>
  9. NNTP-Posting-Host: newton.alcyone.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (X11; I; Linux 1.2.8 i486)
  14.  
  15. Harold Bien wrote:
  16.  
  17. >      You bring up some interesting points.  Though I readily see the
  18. > logic in your approach, I'm curious as to why my approach is
  19. > "incorrect."
  20.  
  21. Hmm -- I never saw anyone say that your approach was incorrect.
  22.  
  23. > The Run() function is the main function called and will
  24. > dispatch to the changing RealRun() function.  However, the Run() function
  25. > doesn't really do much except call _OTHER_ subfuctions.  Therefore,
  26. > should I need new methods like RespondToLight() et al. I will only have
  27. > to put them in the RealRun() function relevant to the state.  Am I
  28. > overlooking something?  I have yet to implement anything, but am afraid
  29. > of commiting myself to something which will not stand up to the test of
  30. > time.  Thanks for your respons.
  31.  
  32. The point is, unless I remember incorrectly, you're using C++, and looking for
  33. some functionality that will allow different functionality to be invoked on
  34. calling member functions to different types of cells, and you'd like these
  35. functions to have similar names.
  36.  
  37. C++ already has this functionality, and you don't have to do anything strange
  38. to implement it.  You declare a class (possibly abstract) in which the member
  39. function (Run, in this case) is virtual; in the subclasses (i.e., the
  40. different types of cells), you define this function differently.  This type of
  41. application is precisely why people use C++ as opposed to C or some other
  42. language.
  43.  
  44. -- 
  45. Erik Max Francis, &tSftDotIotE. && max@alcyone.darkside.com || max@alcyone.com
  46. San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
  47. H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
  48. Omnia quia sunt, lumina sunt. && GIGO Omega Psi && http://www.alcyone.com/max/
  49. "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
  50.